<!DOCTYPE html>
<html>
    <head>
        <script src="./js/brain.js"></script>
    </head>
    <body>
        <h1>Deep Learning with brain.js</h1>
        <div id="demo"></div>
        <div style="color:rgb(0, 0, 128) ;">
        <script>
            const network = new brain.NeuralNetwork();
            //测试异或
            network.train([
                {input:[255/255,255/255,0],output:{yellow:1}},
                {input:[192/255,192/255,0/255],output:{yellow:1}},
                {input:[255/255,0/255,0/255],output:{red:1}},
                {input:[192,0,0],output:{red:1}},
            ])

            let result = network.run([50/255,200/255,128/255]);

            document.getElementById("demo").innerHTML = "Yellow: "+result["yellow"] + "<br>" + "Red: " + result["red"];

        </script>
    </body>
</html>